home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / CMINOR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  1.3 KB  |  44 lines

  1. /* cminor.h - enhancements to C syntax    */
  2.  
  3. /* define file opening modes for gfopen, gopen, gcreat    */
  4. #define BIN_MODE    0
  5. #define ASC_MODE    1
  6.  
  7. /* use the following when the compiler treats char as signed  */
  8. #define tochar(c)   (  (c)  &  0xff  )
  9.  
  10. /* use the following when char is treated as unsigned    */
  11. /* #define  tochar(c)  c                */
  12.  
  13. /* toascii - strip parity bit from a char value     */
  14. #define toascii(c)  (  (c)  &  0x7f  )
  15.  
  16. /* test a char to see whether the high-order bit is zero */
  17. #define isascii(c)  ( ((c)  &  0x80) == 0 )
  18.  
  19. /* test a char to see if it is a printable (ASCII graphic) */
  20. #define isgraphig(c) ( ((c) >= ' ') && ((c) <= '~') )
  21.  
  22. /* English for equality comparison operator        */
  23. #define is ==
  24.  
  25. /* English for logical operators            */
  26. #define and &&
  27. #define or  ||
  28.  
  29. /* portable dara types */
  30. typedef int        int16 ;    /* signed 16 bit integer */
  31. typedef int        INT16 ;    /* signed 16 bit integer */
  32. typedef long        int32 ;    /* signed 32 bit integer */
  33. typedef long        INT32 ;    /* signed 32 bit integer */
  34. typedef unsigned   word16 ;    /* unsigned 16 bit number*/
  35. typedef unsigned   WORD16 ;    /* unsigned 16 bit number*/
  36.  
  37. /* maximum, minimum and absolute macros */
  38. #define max(a,b)    (  (a) < (b) ?  (b) : (a)  )
  39. #define min(a,b)    (  (a) < (b) ?  (a) : (b)  )
  40. #define abs(x)        (  (x) <  0  ? -(x) : (x)  )
  41.  
  42. /* END */
  43.  
  44.